/**
 * Copyright (c) 2007,中企动力华南研发中心<br>
 * All rights reserved.<br>
 */
package com.ce.pms.system.renovation.dao.impl;

import java.util.List;

import org.hibernate.Query;

import com.ce.pms.base.dao.impl.PmsBaseDaoImpl;
import com.ce.pms.base.vo.SearchVO;
import com.ce.pms.system.renovation.dao.IPassChargeItemConfigDao;
import com.ce.pms.system.renovation.model.PassChargeItemConfigDO;
import com.sitechasia.webx.core.support.Page;

/**
 * 功能描述：<br>
 * @author 易贤建 创建日期：2008-12-31<br>
 */
public class PassChargeItemConfigDaoImpl extends PmsBaseDaoImpl<PassChargeItemConfigDO> implements IPassChargeItemConfigDao {
	/**
	 * 功能描述:获取所有未停用的出入证收费项目<br>
	 * @return<br>
	 * Create author:罗军林<br>
	 * Create on:2008-12-29<br>
	 * Edit author:<br>
	 * Edit on:<br>
	 * Why:<br>
	 */
	@SuppressWarnings("unchecked")
	public List<PassChargeItemConfigDO> getAllPassChargeItemConfigs(){
		StringBuffer queryStr = new StringBuffer(" FROM PassChargeItemConfigDO configDO ");
					queryStr.append(" WHERE 1=1 ");
					queryStr.append(" AND configDO.state='001'");
		Query query = super.createQuery(queryStr.toString());
		return query.list();
	}
	/**
	 * 功能描述:查询所有的装修出入证收费项目<br>
	 * @param searchVO
	 * Create author:yixianjian <br>
	 * Create on:2008-12-31  <br>
	 */
	public Page queryPassChargeItemConfigList(SearchVO searchVO){
		String queryStr = " FROM PassChargeItemConfigDO configDO WHERE 1=1 ";
		return super.pagedQueryByPageNo(queryStr, searchVO.getPageNo(), searchVO.getPageSize());
	}
	/**
	 * 功能描述:根据出入证收费项目名称查询出入证收费DO<br>
	 * @param itemName
	 * @return
	 * Create author:yixianjian <br>
	 * Create on:2009-1-4  <br>
	 */
	public List<PassChargeItemConfigDO> findByItemName(String itemName){
		StringBuffer queryStr = new StringBuffer(" FROM PassChargeItemConfigDO configDO ");
					queryStr.append(" WHERE 1=1 ");
					queryStr.append(" AND configDO.itemName=?");
		Query query = super.createQuery(queryStr.toString(),itemName);
		return query.list();
	}
	/**
	 * 功能描述:根据出入证收费项目名称查询不是指定ID的出入证收费项目DO<br>
	 * @param keyword
	 * @param itemName
	 * @return
	 * Create author:yixianjian <br>
	 * Create on:2009-1-4  <br>
	 */
	public List<PassChargeItemConfigDO> findByItemNameWithoutKeyword(Long keyword,String itemName){
		StringBuffer queryStr = new StringBuffer(" FROM PassChargeItemConfigDO configDO ");
						queryStr.append(" WHERE 1=1 ");
						queryStr.append(" AND configDO.keyword!=?");
						queryStr.append(" AND configDO.itemName=?");
		Query query = super.createQuery(queryStr.toString(),keyword,itemName);
		return query.list();
	}
}
